package cn.colins.raft.rpc.handler;


import cn.colins.raft.rpc.codec.RpcDecoder;
import cn.colins.raft.rpc.codec.RpcEncoder;
import cn.colins.raft.rpc.handler.chanel.*;
import io.netty.channel.Channel;
import io.netty.channel.ChannelInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class RpcClientHandlerInit extends ChannelInitializer<Channel> {

    private static final Logger log = LoggerFactory.getLogger(RpcClientHandlerInit.class);


    @Override
    protected void initChannel(Channel channel) throws Exception {
        channel.pipeline().addLast(new RpcDecoder(1024,10,4,0,0));
        channel.pipeline().addLast(new RpcEncoder());
        channel.pipeline().addLast(new HeartBeatResultHandler());
        channel.pipeline().addLast(new VoteRpcResultHandler());
        channel.pipeline().addLast(new LogPreCommitResultHandler());
        channel.pipeline().addLast(new ClientResponseHandler());
        channel.pipeline().addLast(new LogPullRequestResultHandler());
    }
}
